import { version } from '../../package.json'
import { defineUserConfig, defaultTheme } from 'vuepress'
import { demoblockPlugin } from 'vuepress-plugin-demoblock-plus'

export default defineUserConfig({
  base: '/pc',
  lang: 'zh-CN',
  title: 'Watt-PC端UI组件库（适用于Vue 3）',
  description: 'Watt-PC端各种UI组件完故性俩套，从零安装到完善',
  head: [
    ['meta', {name: 'keywords', content: '企业前端，湖南前端，PC端UI库'}],
    ['link', {rel: 'icon', href: '/favicon.ico'}],
    ['script', {}, `
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?64083136379bacde71f5b03c19801250";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
      _hmt.push(['_setAutoPageview', false]);
    `]
  ],
  plugins: [
    demoblockPlugin({
      customClass: 'demoblock-custom',
      // theme: 'github-light',
      cssPreprocessor: 'less',
      scriptReplaces: [
        { searchValue: /const ({ defineComponent as _defineComponent }) = Vue/g,
          replaceValue: 'const { defineComponent: _defineComponent } = Vue'
        }
      ]
    })
  ],
  theme: defaultTheme({
    darkMode: true,
    sidebarDepth: 2, // 侧边栏显示2级
    navbar: [
      { text: '文档首页', link: 'https://doc.jsvue.cn/' },
      { text: version, link: '/'}
    ],
    sidebar: [
      { text: '介绍', link: '/' },
      { text: '所有组件', link: '/components/' },
      { text: '组件', link: '', children: [
        { text: 'watt-upload', link: '/components/watt-upload' },
        { text: 'watt-editor', link: '/components/watt-editor' },
        { text: 'watt-json-editor', link: '/components/watt-json-editor' },
        { text: 'i-upload', link: '/components/i-upload' },
      ] },
      { text: '组件2', link: '', children: [
        { text: '按钮', link: '/components/button' },
        { text: '按钮', link: '/components/button' },
      ] },
      { text: '备用', link: '', children: [
        { text: '图片懒加载', link: '/components/lazyload' },
      ] },
    ]
  })
})
